﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.User.UserDetail>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    用户资料
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.BeginForm(); %>
    <fieldset>
        <legend>基本信息</legend>
        <ul class="editlist">
            <li><span class="label">用户名:</span>
                <label id="lbl1">
                    <%=Model.LoginName %></label>
                <%=Html.HiddenFor(p => p.LoginName)%>
            </li>
            <li><span class="label"><font color='red'>*</font>Email:</span>
                <%if (Model.IsSave)
                  { %>
                <label>
                    <%=Model.Email %></label>
                <%}
                  else
                  { %>
                <%=Html.TextBoxFor(p => p.Email)%>
                <%=Html.ValidationMessageFor(p => p.Email)%><font color="blue" size='1'>(邮箱为您找回密码等操作的依据,请认真填写)☆</font>
                <%} %>
            </li>
            <li><span class="label">QQ:</span>
                <% if (Model.Locked)
                   { %>
                <label>
                    <%=Model.QQ%></label>
                <%=Html.HiddenFor(p => p.QQ)%>
                <%}
                   else
                   {
                %>
                <%=Html.TextBoxFor(p => p.QQ)%>
                <%=Html.ValidationMessageFor(p => p.QQ)%>
                <%=Html.Hidden("OldDetail.QQ",Model.QQ) %>
                <%} %>
            </li>
            <li><span class="label">电话:</span>
                <% if (Model.Locked)
                   { %>
                <label>
                    <%=Model.Tel%></label>
                <%=Html.HiddenFor(p => p.Tel)%>
                <%}
                   else
                   {
                %>
                <%=Html.TextBoxFor(p => p.Tel)%>
                <%=Html.ValidationMessageFor(p => p.Tel)%>
                <%=Html.Hidden("OldDetail.Tel",Model.Tel) %>
                <%} %>
            </li>
            <li><span class="label"><font color='red'>*</font>开户银行:</span>
                <% if (Model.Locked)
                   { %>
                <label>
                    <%=Model.BankName %></label>
                <%=Html.HiddenFor(p=>p.BankID) %>
                <%}
                   else
                   {
                %>
                <%Html.RenderAction("Bank", "Commen", new { id = Model.BankID, controlName = "BankID" });%>
                <%=Html.ValidationMessageFor(p=>p.BankID ) %>
                <%=Html.Hidden("OldDetail.BankID", Model.BankID)%>
                <%
                   } %>
            </li>
            <li><span class="label"><font color='red'>*</font>银行卡号:</span>
                <%if (Model.Locked)
                  { %>
                <label>
                    <%=Model.BankCardNo %></label>
                <%=Html.HiddenFor(p=>p.BankCardNo) %>
                <%}
                  else
                  { %>
                <%= Html.TextBoxFor(p => p.BankCardNo)%>
                <%=Html.ValidationMessageFor(p => p.BankCardNo)%>
                <%=Html.Hidden("OldDetail.BankCardNo", Model.BankCardNo)%>
                <%} %>
            </li>
            <li><span class="label"><font color='red'>*</font>开户城市:</span>
                <% if (Model.Locked)
                   {
                       if (Model.BankCityProvinceName == "其它")
                       {%>
                <label>
                    <%=Model.BankCityProvinceName %></label>
                <%}
                       else
                       { %>
                <label>
                    <%=Model.BankCityProvinceName%>省
                    <%=Model.BankCityName%>市</label>
                <%}%>
                <%=Html.HiddenFor(p => p.BankCityID)%>
                <%}
                   else
                   {
                %>
                <%Html.RenderAction("City", "Commen", new { id = Model.BankCityID, colname = "BankCityID" }); %>
                <%=Html.ValidationMessageFor(p => p.BankCityID, "请选择城市")%>
                <%=Html.Hidden("OldDetail.BankCityID", Model.BankCityID)%>
                <%
                   } %>
            </li>
            <li><span class="label">银行详情/街道:</span>
                <%if (Model.Locked)
                  { %>
                <label>
                    <%=Model.BankStreetName %></label>
                <%=Html.HiddenFor(p=>p.BankStreetName) %>
                <%}
                  else
                  { %>
                <%=Html.TextBoxFor(p => p.BankStreetName)%>
                <%=Html.ValidationMessageFor(p => p.BankStreetName)%>
                <%=Html.Hidden("OldDetail.BankStreetName", Model.BankStreetName)%>
                <%} %>
            </li>
            <%--<li><span class="label"><font color='red'>*</font>网上支付账号:</span>
                <%if (Model.Locked)
                  { %>
                <label>
                    <%=Model.PayAccount%></label>
                <%=Html.HiddenFor(p => p.PayAccount)%>
                <%}
                  else
                  { %>
                <%=Html.TextBoxFor(p => p.PayAccount)%>
                <%=Html.ValidationMessageFor(p => p.PayAccount)%>
                请写明支付名称和账号，如:财付通 123456
                <%=Html.Hidden("OldDetail.PayAccount", Model.PayAccount)%>
                <%} %>
            </li>--%>
            <li><span class="label"><font color='red'>*</font>真实姓名:</span>
                <%if (Model.Locked)
                  { %>
                <label>
                    <%=Model.Name%></label>
                <%=Html.HiddenFor(p => p.Name)%>
                <%}
                  else
                  { %>
                <%=Html.TextBoxFor(p => p.Name)%>
                <%=Html.ValidationMessageFor(p => p.Name)%>
                <%=Html.Hidden("OldDetail.Name", Model.Name)%>
                <%} %>
            </li>
            <li><span class="label"><font color='red'>*</font>登录密码:</span>
                <input type="password" id="LoginPwd" name="LoginPwd" />
                <%=Html.ValidationMessageFor(p=>p.LoginPwd) %>
            </li>
            <li><span class="label"><font color='red'>*</font>验证码:</span>
                <%=Html.TextBoxFor(p => p.CheckCode ,new {@class="input_Text" })%>
                <img src='<%=Url.Content("~/Login/CheckCode/EditInfo") %>' onclick="this.src+='?'"
                    height="25px" alt="点击换一张" />
                <%=Html.ValidationMessageFor(p=>p.CheckCode) %>
            </li>
            <li class="btn">
                <input type="submit" value="保存" <%=Model.IsSave?"name='save2'":"name='save'" %> <%=Model.Locked?"disabled":"" %> />
                &nbsp;&nbsp;&nbsp;
                <% if (!Model.Locked)
                   { %>
                <input type="submit" value="锁定" name="lock" <%=Model.IsSave?"":"disabled" %> />
                <font size='2' color="red">(提示:锁定之后就不能再修改)</font></li>
            <%}
                   else
                   {%>
            <input type="button" value="解锁" id="btnFree" name="btnFree" onclick="GetFreeKey()" /></li>
            <li id="li_FreeTable" style="display: none;">
                <table class="table" width="300">
                    <tr>
                        <td align="right">
                            请输入密钥:
                        </td>
                        <td align="left">
                            <input id="txtKey" name="txtKey" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan='2' align="center">
                            <input type="button" value="提交" id="btnOk" name="btnOk" onclick="Free()" />&nbsp;&nbsp;
                            <input type="button" value="重新获取密钥" id="btnGetKey" name="btnGetKey" onclick="GetFreeKey()" />
                        </td>
                    </tr>
                </table>
            </li>
            <%}%>
        </ul>
    </fieldset>
    <% Html.EndForm(); %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
    <style type="text/css">
        #lbl1
        {
            text-align: left;
        }
        .input_Text
        {
            width: 50px;
        }
    </style>
    <script type="text/javascript">
        function GetFreeKey() {
            document.getElementById('btnFree').style.display = 'none';
            document.getElementById('btnGetKey').disabled = true;

            getJSON('<%=Url.Action("GetDetailFreeKey","User") %>', null, function (result) {
                if (result.flag > 0) {
                    li_FreeTable.style.display = 'block';
                }
                if (result.msg.length)
                    alert(result.msg);
                document.getElementById('btnGetKey').disabled = false;
            });
        }
        function Free() {
            var value = document.getElementById('txtKey').value;
            if (value == '')
                alert('请先输入密钥');
            else {
                document.getElementById('btnOk').disabled = true;
                getJSON('<%=Url.Action("Detail_Free","User") %>', { detailFreeKey: value }, function (result) {
                    if (result.msg.length)
                        alert(result.msg);
                    if (result.count > 0)
                        window.location.href = location.href;
                    document.getElementById('btnOk').disabled = false;
                });
            }
        }
    </script>
</asp:Content>
